package com.skillscompetition.skillscompetition.controller;


import com.skillscompetition.skillscompetition.bean.Examinee;
import com.skillscompetition.skillscompetition.common.ResponseType;
import com.skillscompetition.skillscompetition.service.impl.ExamineeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lwg
 * @since 2019-11-09
 */
@RestController
@RequestMapping("/examinee")
public class ExamineeController {

    @Autowired
    private ExamineeServiceImpl examineeService;

    /*查询全部查询人员*/
    @GetMapping
    public Map<String,Object> getExaminee(@RequestParam(value = "page",defaultValue = "1") Integer page,
                                          @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                          @RequestParam(value = "sort",required = false)String sort){
        return ResponseType.success(examineeService.getExaminee(page,pageSize,sort));
    }

    /*更新参赛人员资料*/
    @PutMapping
    public Map<String,Object> update(@RequestBody Examinee examinee){
        Boolean aBoolean = examineeService.updateExaminee(examinee);
        return ResponseType.success(aBoolean);
    }

}
